Skip to content

Conversation

@clementval
Copy link
Contributor

While I was updating the creation of CUF operation in #152050, I noticed some other places in flang that were not updated. This patch updates the FIR operation creations in flang/unittests

@llvmbot llvmbot added flang Flang issues not falling into any other category flang:fir-hlfir labels Aug 4, 2025
@llvmbot
Copy link
Member

llvmbot commented Aug 4, 2025

@llvm/pr-subscribers-flang-fir-hlfir

Author: Valentin Clement (バレンタイン クレメン) (clementval)

Changes

While I was updating the creation of CUF operation in #152050, I noticed some other places in flang that were not updated. This patch updates the FIR operation creations in flang/unittests


Patch is 29.22 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/152056.diff

9 Files Affected:

  • (modified) flang/unittests/Optimizer/Builder/Runtime/AllocatableTest.cpp (+3-3)
  • (modified) flang/unittests/Optimizer/Builder/Runtime/AssignTest.cpp (+2-2)
  • (modified) flang/unittests/Optimizer/Builder/Runtime/CharacterTest.cpp (+24-24)
  • (modified) flang/unittests/Optimizer/Builder/Runtime/CommandTest.cpp (+9-9)
  • (modified) flang/unittests/Optimizer/Builder/Runtime/DerivedTest.cpp (+2-2)
  • (modified) flang/unittests/Optimizer/Builder/Runtime/RaggedTest.cpp (+2-2)
  • (modified) flang/unittests/Optimizer/Builder/Runtime/ReductionTest.cpp (+12-12)
  • (modified) flang/unittests/Optimizer/Builder/Runtime/TransformationalTest.cpp (+35-35)
  • (modified) flang/unittests/Optimizer/FortranVariableTest.cpp (+12-12)
diff --git a/flang/unittests/Optimizer/Builder/Runtime/AllocatableTest.cpp b/flang/unittests/Optimizer/Builder/Runtime/AllocatableTest.cpp
index f618e72d7b7f3..cdfc91508ed49 100644
--- a/flang/unittests/Optimizer/Builder/Runtime/AllocatableTest.cpp
+++ b/flang/unittests/Optimizer/Builder/Runtime/AllocatableTest.cpp
@@ -17,9 +17,9 @@ TEST_F(RuntimeCallTest, genMoveAlloc) {
   mlir::Location loc = firBuilder->getUnknownLoc();
   mlir::Type seqTy =
       fir::SequenceType::get(fir::SequenceType::Shape(1, 10), i32Ty);
-  mlir::Value from = firBuilder->create<fir::UndefOp>(loc, seqTy);
-  mlir::Value to = firBuilder->create<fir::UndefOp>(loc, seqTy);
-  mlir::Value errMsg = firBuilder->create<fir::UndefOp>(loc, seqTy);
+  mlir::Value from = fir::UndefOp::create(*firBuilder, loc, seqTy);
+  mlir::Value to = fir::UndefOp::create(*firBuilder, loc, seqTy);
+  mlir::Value errMsg = fir::UndefOp::create(*firBuilder, loc, seqTy);
   mlir::Value hasStat = firBuilder->createBool(loc, false);
   fir::runtime::genMoveAlloc(*firBuilder, loc, to, from, hasStat, errMsg);
   checkCallOpFromResultBox(to, "_FortranAMoveAlloc", 5);
diff --git a/flang/unittests/Optimizer/Builder/Runtime/AssignTest.cpp b/flang/unittests/Optimizer/Builder/Runtime/AssignTest.cpp
index 8bf7b1d266444..e7d35bd7f9e5e 100644
--- a/flang/unittests/Optimizer/Builder/Runtime/AssignTest.cpp
+++ b/flang/unittests/Optimizer/Builder/Runtime/AssignTest.cpp
@@ -14,8 +14,8 @@ TEST_F(RuntimeCallTest, genDerivedTypeAssign) {
   auto loc = firBuilder->getUnknownLoc();
   mlir::Type seqTy =
       fir::SequenceType::get(fir::SequenceType::Shape(1, 10), i32Ty);
-  mlir::Value source = firBuilder->create<fir::UndefOp>(loc, seqTy);
-  mlir::Value dest = firBuilder->create<fir::UndefOp>(loc, seqTy);
+  mlir::Value source = fir::UndefOp::create(*firBuilder, loc, seqTy);
+  mlir::Value dest = fir::UndefOp::create(*firBuilder, loc, seqTy);
   fir::runtime::genAssign(*firBuilder, loc, dest, source);
   checkCallOpFromResultBox(dest, "_FortranAAssign", 2);
 }
diff --git a/flang/unittests/Optimizer/Builder/Runtime/CharacterTest.cpp b/flang/unittests/Optimizer/Builder/Runtime/CharacterTest.cpp
index cfd2d489ac578..f3b0fde175bac 100644
--- a/flang/unittests/Optimizer/Builder/Runtime/CharacterTest.cpp
+++ b/flang/unittests/Optimizer/Builder/Runtime/CharacterTest.cpp
@@ -15,16 +15,16 @@ using namespace mlir;
 
 TEST_F(RuntimeCallTest, genAdjustLTest) {
   auto loc = firBuilder->getUnknownLoc();
-  mlir::Value result = firBuilder->create<fir::UndefOp>(loc, boxTy);
-  mlir::Value string = firBuilder->create<fir::UndefOp>(loc, boxTy);
+  mlir::Value result = fir::UndefOp::create(*firBuilder, loc, boxTy);
+  mlir::Value string = fir::UndefOp::create(*firBuilder, loc, boxTy);
   fir::runtime::genAdjustL(*firBuilder, loc, result, string);
   checkCallOpFromResultBox(result, "_FortranAAdjustl", 2);
 }
 
 TEST_F(RuntimeCallTest, genAdjustRTest) {
   auto loc = firBuilder->getUnknownLoc();
-  mlir::Value result = firBuilder->create<fir::UndefOp>(loc, boxTy);
-  mlir::Value string = firBuilder->create<fir::UndefOp>(loc, boxTy);
+  mlir::Value result = fir::UndefOp::create(*firBuilder, loc, boxTy);
+  mlir::Value string = fir::UndefOp::create(*firBuilder, loc, boxTy);
   fir::runtime::genAdjustR(*firBuilder, loc, result, string);
   checkCallOpFromResultBox(result, "_FortranAAdjustr", 2);
 }
@@ -115,11 +115,11 @@ TEST_F(RuntimeCallTest, genIndexTest) {
 
 TEST_F(RuntimeCallTest, genIndexDescriptorTest) {
   auto loc = firBuilder->getUnknownLoc();
-  mlir::Value resultBox = firBuilder->create<fir::UndefOp>(loc, boxTy);
-  mlir::Value stringBox = firBuilder->create<fir::UndefOp>(loc, boxTy);
-  mlir::Value substringBox = firBuilder->create<fir::UndefOp>(loc, boxTy);
-  mlir::Value backOpt = firBuilder->create<fir::UndefOp>(loc, boxTy);
-  mlir::Value kind = firBuilder->create<fir::UndefOp>(loc, i32Ty);
+  mlir::Value resultBox = fir::UndefOp::create(*firBuilder, loc, boxTy);
+  mlir::Value stringBox = fir::UndefOp::create(*firBuilder, loc, boxTy);
+  mlir::Value substringBox = fir::UndefOp::create(*firBuilder, loc, boxTy);
+  mlir::Value backOpt = fir::UndefOp::create(*firBuilder, loc, boxTy);
+  mlir::Value kind = fir::UndefOp::create(*firBuilder, loc, i32Ty);
   fir::runtime::genIndexDescriptor(
       *firBuilder, loc, resultBox, stringBox, substringBox, backOpt, kind);
   checkCallOpFromResultBox(resultBox, "_FortranAIndex", 5);
@@ -127,28 +127,28 @@ TEST_F(RuntimeCallTest, genIndexDescriptorTest) {
 
 TEST_F(RuntimeCallTest, genRepeatTest) {
   auto loc = firBuilder->getUnknownLoc();
-  mlir::Value resultBox = firBuilder->create<fir::UndefOp>(loc, boxTy);
-  mlir::Value stringBox = firBuilder->create<fir::UndefOp>(loc, boxTy);
-  mlir::Value ncopies = firBuilder->create<fir::UndefOp>(loc, i32Ty);
+  mlir::Value resultBox = fir::UndefOp::create(*firBuilder, loc, boxTy);
+  mlir::Value stringBox = fir::UndefOp::create(*firBuilder, loc, boxTy);
+  mlir::Value ncopies = fir::UndefOp::create(*firBuilder, loc, i32Ty);
   fir::runtime::genRepeat(*firBuilder, loc, resultBox, stringBox, ncopies);
   checkCallOpFromResultBox(resultBox, "_FortranARepeat", 3);
 }
 
 TEST_F(RuntimeCallTest, genTrimTest) {
   auto loc = firBuilder->getUnknownLoc();
-  mlir::Value resultBox = firBuilder->create<fir::UndefOp>(loc, boxTy);
-  mlir::Value stringBox = firBuilder->create<fir::UndefOp>(loc, boxTy);
+  mlir::Value resultBox = fir::UndefOp::create(*firBuilder, loc, boxTy);
+  mlir::Value stringBox = fir::UndefOp::create(*firBuilder, loc, boxTy);
   fir::runtime::genTrim(*firBuilder, loc, resultBox, stringBox);
   checkCallOpFromResultBox(resultBox, "_FortranATrim", 2);
 }
 
 TEST_F(RuntimeCallTest, genScanDescriptorTest) {
   auto loc = firBuilder->getUnknownLoc();
-  mlir::Value resultBox = firBuilder->create<fir::UndefOp>(loc, boxTy);
-  mlir::Value stringBox = firBuilder->create<fir::UndefOp>(loc, boxTy);
-  mlir::Value setBox = firBuilder->create<fir::UndefOp>(loc, boxTy);
-  mlir::Value backBox = firBuilder->create<fir::UndefOp>(loc, boxTy);
-  mlir::Value kind = firBuilder->create<fir::UndefOp>(loc, i32Ty);
+  mlir::Value resultBox = fir::UndefOp::create(*firBuilder, loc, boxTy);
+  mlir::Value stringBox = fir::UndefOp::create(*firBuilder, loc, boxTy);
+  mlir::Value setBox = fir::UndefOp::create(*firBuilder, loc, boxTy);
+  mlir::Value backBox = fir::UndefOp::create(*firBuilder, loc, boxTy);
+  mlir::Value kind = fir::UndefOp::create(*firBuilder, loc, i32Ty);
   fir::runtime::genScanDescriptor(
       *firBuilder, loc, resultBox, stringBox, setBox, backBox, kind);
   checkCallOpFromResultBox(resultBox, "_FortranAScan", 5);
@@ -178,11 +178,11 @@ TEST_F(RuntimeCallTest, genScanTest) {
 
 TEST_F(RuntimeCallTest, genVerifyDescriptorTest) {
   auto loc = firBuilder->getUnknownLoc();
-  mlir::Value resultBox = firBuilder->create<fir::UndefOp>(loc, boxTy);
-  mlir::Value stringBox = firBuilder->create<fir::UndefOp>(loc, boxTy);
-  mlir::Value setBox = firBuilder->create<fir::UndefOp>(loc, boxTy);
-  mlir::Value backBox = firBuilder->create<fir::UndefOp>(loc, boxTy);
-  mlir::Value kind = firBuilder->create<fir::UndefOp>(loc, i32Ty);
+  mlir::Value resultBox = fir::UndefOp::create(*firBuilder, loc, boxTy);
+  mlir::Value stringBox = fir::UndefOp::create(*firBuilder, loc, boxTy);
+  mlir::Value setBox = fir::UndefOp::create(*firBuilder, loc, boxTy);
+  mlir::Value backBox = fir::UndefOp::create(*firBuilder, loc, boxTy);
+  mlir::Value kind = fir::UndefOp::create(*firBuilder, loc, i32Ty);
   fir::runtime::genVerifyDescriptor(
       *firBuilder, loc, resultBox, stringBox, setBox, backBox, kind);
   checkCallOpFromResultBox(resultBox, "_FortranAVerify", 5);
diff --git a/flang/unittests/Optimizer/Builder/Runtime/CommandTest.cpp b/flang/unittests/Optimizer/Builder/Runtime/CommandTest.cpp
index 8bc1e87814a98..c59f3395b5bd6 100644
--- a/flang/unittests/Optimizer/Builder/Runtime/CommandTest.cpp
+++ b/flang/unittests/Optimizer/Builder/Runtime/CommandTest.cpp
@@ -21,10 +21,10 @@ TEST_F(RuntimeCallTest, genGetCommandArgument) {
   mlir::Location loc = firBuilder->getUnknownLoc();
   mlir::Type intTy = firBuilder->getDefaultIntegerType();
   mlir::Type boxTy = fir::BoxType::get(firBuilder->getNoneType());
-  mlir::Value number = firBuilder->create<fir::UndefOp>(loc, intTy);
-  mlir::Value value = firBuilder->create<fir::UndefOp>(loc, boxTy);
-  mlir::Value length = firBuilder->create<fir::UndefOp>(loc, boxTy);
-  mlir::Value errmsg = firBuilder->create<fir::UndefOp>(loc, boxTy);
+  mlir::Value number = fir::UndefOp::create(*firBuilder, loc, intTy);
+  mlir::Value value = fir::UndefOp::create(*firBuilder, loc, boxTy);
+  mlir::Value length = fir::UndefOp::create(*firBuilder, loc, boxTy);
+  mlir::Value errmsg = fir::UndefOp::create(*firBuilder, loc, boxTy);
   mlir::Value result = fir::runtime::genGetCommandArgument(
       *firBuilder, loc, number, value, length, errmsg);
   checkCallOp(result.getDefiningOp(), "_FortranAGetCommandArgument",
@@ -34,11 +34,11 @@ TEST_F(RuntimeCallTest, genGetCommandArgument) {
 
 TEST_F(RuntimeCallTest, genGetEnvVariable) {
   mlir::Location loc = firBuilder->getUnknownLoc();
-  mlir::Value name = firBuilder->create<fir::UndefOp>(loc, boxTy);
-  mlir::Value value = firBuilder->create<fir::UndefOp>(loc, boxTy);
-  mlir::Value length = firBuilder->create<fir::UndefOp>(loc, boxTy);
-  mlir::Value trimName = firBuilder->create<fir::UndefOp>(loc, i1Ty);
-  mlir::Value errmsg = firBuilder->create<fir::UndefOp>(loc, boxTy);
+  mlir::Value name = fir::UndefOp::create(*firBuilder, loc, boxTy);
+  mlir::Value value = fir::UndefOp::create(*firBuilder, loc, boxTy);
+  mlir::Value length = fir::UndefOp::create(*firBuilder, loc, boxTy);
+  mlir::Value trimName = fir::UndefOp::create(*firBuilder, loc, i1Ty);
+  mlir::Value errmsg = fir::UndefOp::create(*firBuilder, loc, boxTy);
   mlir::Value result = fir::runtime::genGetEnvVariable(
       *firBuilder, loc, name, value, length, trimName, errmsg);
   checkCallOp(result.getDefiningOp(), "_FortranAGetEnvVariable", /*nbArgs=*/5,
diff --git a/flang/unittests/Optimizer/Builder/Runtime/DerivedTest.cpp b/flang/unittests/Optimizer/Builder/Runtime/DerivedTest.cpp
index d5654523c9e29..75c603414be32 100644
--- a/flang/unittests/Optimizer/Builder/Runtime/DerivedTest.cpp
+++ b/flang/unittests/Optimizer/Builder/Runtime/DerivedTest.cpp
@@ -14,7 +14,7 @@ TEST_F(RuntimeCallTest, genDerivedTypeInitialize) {
   auto loc = firBuilder->getUnknownLoc();
   mlir::Type seqTy =
       fir::SequenceType::get(fir::SequenceType::Shape(1, 10), i32Ty);
-  mlir::Value box = firBuilder->create<fir::UndefOp>(loc, seqTy);
+  mlir::Value box = fir::UndefOp::create(*firBuilder, loc, seqTy);
   fir::runtime::genDerivedTypeInitialize(*firBuilder, loc, box);
   checkCallOpFromResultBox(box, "_FortranAInitialize", 1);
 }
@@ -23,7 +23,7 @@ TEST_F(RuntimeCallTest, genDerivedTypeDestroy) {
   auto loc = firBuilder->getUnknownLoc();
   mlir::Type seqTy =
       fir::SequenceType::get(fir::SequenceType::Shape(1, 10), i32Ty);
-  mlir::Value box = firBuilder->create<fir::UndefOp>(loc, seqTy);
+  mlir::Value box = fir::UndefOp::create(*firBuilder, loc, seqTy);
   fir::runtime::genDerivedTypeDestroy(*firBuilder, loc, box);
   checkCallOpFromResultBox(box, "_FortranADestroy", 1, /*addLocArg=*/false);
 }
diff --git a/flang/unittests/Optimizer/Builder/Runtime/RaggedTest.cpp b/flang/unittests/Optimizer/Builder/Runtime/RaggedTest.cpp
index f76a5477baa3a..b0fb1ccb1b966 100644
--- a/flang/unittests/Optimizer/Builder/Runtime/RaggedTest.cpp
+++ b/flang/unittests/Optimizer/Builder/Runtime/RaggedTest.cpp
@@ -14,7 +14,7 @@ TEST_F(RuntimeCallTest, genRaggedArrayAllocateTest) {
   auto loc = firBuilder->getUnknownLoc();
   mlir::TupleType headerTy =
       fir::factory::getRaggedArrayHeaderType(*firBuilder);
-  mlir::Value header = firBuilder->create<fir::UndefOp>(loc, headerTy);
+  mlir::Value header = fir::UndefOp::create(*firBuilder, loc, headerTy);
   mlir::Value eleSize = firBuilder->createIntegerConstant(loc, i32Ty, 1);
   mlir::Value extent = firBuilder->createIntegerConstant(loc, i32Ty, 1);
   // Use a dummy header just to test the correctness of the generated call.
@@ -29,7 +29,7 @@ TEST_F(RuntimeCallTest, genRaggedArrayDeallocateTest) {
   mlir::TupleType headerTy =
       fir::factory::getRaggedArrayHeaderType(*firBuilder);
   // Use a dummy header just to test the correctness of the generated call.
-  mlir::Value header = firBuilder->create<fir::UndefOp>(loc, headerTy);
+  mlir::Value header = fir::UndefOp::create(*firBuilder, loc, headerTy);
   fir::runtime::genRaggedArrayDeallocate(loc, *firBuilder, header);
   checkCallOpFromResultBox(
       header, "_FortranARaggedArrayDeallocate", 1, /*addLocArgs=*/false);
diff --git a/flang/unittests/Optimizer/Builder/Runtime/ReductionTest.cpp b/flang/unittests/Optimizer/Builder/Runtime/ReductionTest.cpp
index 91e2d0b41cd47..fd0b47eacb9bc 100644
--- a/flang/unittests/Optimizer/Builder/Runtime/ReductionTest.cpp
+++ b/flang/unittests/Optimizer/Builder/Runtime/ReductionTest.cpp
@@ -12,7 +12,7 @@
 
 TEST_F(RuntimeCallTest, genAllTest) {
   mlir::Location loc = firBuilder->getUnknownLoc();
-  mlir::Value undef = firBuilder->create<fir::UndefOp>(loc, seqTy10);
+  mlir::Value undef = fir::UndefOp::create(*firBuilder, loc, seqTy10);
   mlir::Value dim = firBuilder->createIntegerConstant(loc, i32Ty, 1);
   mlir::Value all = fir::runtime::genAll(*firBuilder, loc, undef, dim);
   checkCallOp(all.getDefiningOp(), "_FortranAAll", 2);
@@ -20,8 +20,8 @@ TEST_F(RuntimeCallTest, genAllTest) {
 
 TEST_F(RuntimeCallTest, genAllDescriptorTest) {
   mlir::Location loc = firBuilder->getUnknownLoc();
-  mlir::Value result = firBuilder->create<fir::UndefOp>(loc, seqTy10);
-  mlir::Value mask = firBuilder->create<fir::UndefOp>(loc, seqTy10);
+  mlir::Value result = fir::UndefOp::create(*firBuilder, loc, seqTy10);
+  mlir::Value mask = fir::UndefOp::create(*firBuilder, loc, seqTy10);
   mlir::Value dim = firBuilder->createIntegerConstant(loc, i32Ty, 1);
   fir::runtime::genAllDescriptor(*firBuilder, loc, result, mask, dim);
   checkCallOpFromResultBox(result, "_FortranAAllDim", 3);
@@ -29,7 +29,7 @@ TEST_F(RuntimeCallTest, genAllDescriptorTest) {
 
 TEST_F(RuntimeCallTest, genAnyTest) {
   mlir::Location loc = firBuilder->getUnknownLoc();
-  mlir::Value undef = firBuilder->create<fir::UndefOp>(loc, seqTy10);
+  mlir::Value undef = fir::UndefOp::create(*firBuilder, loc, seqTy10);
   mlir::Value dim = firBuilder->createIntegerConstant(loc, i32Ty, 1);
   mlir::Value any = fir::runtime::genAny(*firBuilder, loc, undef, dim);
   checkCallOp(any.getDefiningOp(), "_FortranAAny", 2);
@@ -37,8 +37,8 @@ TEST_F(RuntimeCallTest, genAnyTest) {
 
 TEST_F(RuntimeCallTest, genAnyDescriptorTest) {
   mlir::Location loc = firBuilder->getUnknownLoc();
-  mlir::Value result = firBuilder->create<fir::UndefOp>(loc, seqTy10);
-  mlir::Value mask = firBuilder->create<fir::UndefOp>(loc, seqTy10);
+  mlir::Value result = fir::UndefOp::create(*firBuilder, loc, seqTy10);
+  mlir::Value mask = fir::UndefOp::create(*firBuilder, loc, seqTy10);
   mlir::Value dim = firBuilder->createIntegerConstant(loc, i32Ty, 1);
   fir::runtime::genAnyDescriptor(*firBuilder, loc, result, mask, dim);
   checkCallOpFromResultBox(result, "_FortranAAnyDim", 3);
@@ -46,7 +46,7 @@ TEST_F(RuntimeCallTest, genAnyDescriptorTest) {
 
 TEST_F(RuntimeCallTest, genCountTest) {
   mlir::Location loc = firBuilder->getUnknownLoc();
-  mlir::Value undef = firBuilder->create<fir::UndefOp>(loc, seqTy10);
+  mlir::Value undef = fir::UndefOp::create(*firBuilder, loc, seqTy10);
   mlir::Value dim = firBuilder->createIntegerConstant(loc, i32Ty, 1);
   mlir::Value count = fir::runtime::genCount(*firBuilder, loc, undef, dim);
   checkCallOp(count.getDefiningOp(), "_FortranACount", 2);
@@ -54,8 +54,8 @@ TEST_F(RuntimeCallTest, genCountTest) {
 
 TEST_F(RuntimeCallTest, genCountDimTest) {
   mlir::Location loc = firBuilder->getUnknownLoc();
-  mlir::Value result = firBuilder->create<fir::UndefOp>(loc, seqTy10);
-  mlir::Value mask = firBuilder->create<fir::UndefOp>(loc, seqTy10);
+  mlir::Value result = fir::UndefOp::create(*firBuilder, loc, seqTy10);
+  mlir::Value mask = fir::UndefOp::create(*firBuilder, loc, seqTy10);
   mlir::Value dim = firBuilder->createIntegerConstant(loc, i32Ty, 1);
   mlir::Value kind = firBuilder->createIntegerConstant(loc, i32Ty, 1);
   fir::runtime::genCountDim(*firBuilder, loc, result, mask, dim, kind);
@@ -114,7 +114,7 @@ TEST_F(RuntimeCallTest, genMinValTest) {
 
 TEST_F(RuntimeCallTest, genParityTest) {
   mlir::Location loc = firBuilder->getUnknownLoc();
-  mlir::Value undef = firBuilder->create<fir::UndefOp>(loc, seqTy10);
+  mlir::Value undef = fir::UndefOp::create(*firBuilder, loc, seqTy10);
   mlir::Value dim = firBuilder->createIntegerConstant(loc, i32Ty, 1);
   mlir::Value parity = fir::runtime::genParity(*firBuilder, loc, undef, dim);
   checkCallOp(parity.getDefiningOp(), "_FortranAParity", 2);
@@ -122,8 +122,8 @@ TEST_F(RuntimeCallTest, genParityTest) {
 
 TEST_F(RuntimeCallTest, genParityDescriptorTest) {
   mlir::Location loc = firBuilder->getUnknownLoc();
-  mlir::Value result = firBuilder->create<fir::UndefOp>(loc, seqTy10);
-  mlir::Value mask = firBuilder->create<fir::UndefOp>(loc, seqTy10);
+  mlir::Value result = fir::UndefOp::create(*firBuilder, loc, seqTy10);
+  mlir::Value mask = fir::UndefOp::create(*firBuilder, loc, seqTy10);
   mlir::Value dim = firBuilder->createIntegerConstant(loc, i32Ty, 1);
   fir::runtime::genParityDescriptor(*firBuilder, loc, result, mask, dim);
   checkCallOpFromResultBox(result, "_FortranAParityDim", 3);
diff --git a/flang/unittests/Optimizer/Builder/Runtime/TransformationalTest.cpp b/flang/unittests/Optimizer/Builder/Runtime/TransformationalTest.cpp
index b8e89556f1fc8..d118ba690b2d8 100644
--- a/flang/unittests/Optimizer/Builder/Runtime/TransformationalTest.cpp
+++ b/flang/unittests/Optimizer/Builder/Runtime/TransformationalTest.cpp
@@ -100,10 +100,10 @@ TEST_F(RuntimeCallTest, genCshiftTest) {
   auto loc = firBuilder->getUnknownLoc();
   mlir::Type seqTy =
       fir::SequenceType::get(fir::SequenceType::Shape(1, 10), i32Ty);
-  mlir::Value result = firBuilder->create<fir::UndefOp>(loc, seqTy);
-  mlir::Value array = firBuilder->create<fir::UndefOp>(loc, seqTy);
-  mlir::Value shift = firBuilder->create<fir::UndefOp>(loc, seqTy);
-  mlir::Value dim = firBuilder->create<fir::UndefOp>(loc, seqTy);
+  mlir::Value result = fir::UndefOp::create(*firBuilder, loc, seqTy);
+  mlir::Value array = fir::UndefOp::create(*firBuilder, loc, seqTy);
+  mlir::Value shift = fir::UndefOp::create(*firBuilder, loc, seqTy);
+  mlir::Value dim = fir::UndefOp::create(*firBuilder, loc, seqTy);
   fir::runtime::genCshift(*firBuilder, loc, result, array, shift, dim);
   checkCallOpFromResultBox(result, "_FortranACshift", 4);
 }
@@ -112,9 +112,9 @@ TEST_F(RuntimeCallTest, genCshiftVectorTest) {
   auto loc = firBuilder->getUnknownLoc();
   mlir::Type seqTy =
       fir::SequenceType::get(fir::SequenceType::Shape(1, 10), i32Ty);
-  mlir::Value result = firBuilder->create<fir::UndefOp>(loc, seqTy);
-  mlir::Value array = firBuilder->create<fir::UndefOp>(loc, seqTy);
-  mlir::Value shift = firBuilder->create<fir::UndefOp>(loc, seqTy);
+  mlir::Value result = fir::UndefOp::create(*firBuilder, loc, seqTy);
+  mlir::Value array = fir::UndefOp::create(*firBuilder, loc, seqTy);
+  mlir::Value shift = fir::UndefOp::create(*firBuilder, loc, seqTy);
   fir::runtime::genCshiftVector(*firBuilder, loc, result, array, shift);
   checkCallOpFromResultBox(result, "_FortranACshiftVector", 3);
 }
@@ -123,11 +123,11 @@ TEST_F(RuntimeCallTest, genEoshiftTest) {
   auto loc = firBuilder->getUnknownLoc();
   mlir::Type seqTy =
       fir::SequenceType::get(fir::SequenceType::Shape(1, 10), i32Ty);
-  mlir::Value result = firBuilder->create<fir::UndefOp>(loc, seqTy);
-  mlir::Value array = firBuilder->create<fir::UndefOp>(loc, seqTy);
-  mlir::Value shift = firBuilder->create<fir::UndefOp>(loc, seqTy);
-  mlir::Value bound = firBuilder->create<fir::UndefOp>(loc, seqTy);
-  mlir::Value dim = firBuilder->create<fir::UndefOp>(loc, seqTy);
+  mlir::Value result = fir::UndefOp::create(*firBuilder, loc, seqTy);
+  mlir::Value array = fir::UndefOp::create(*firBuilder, loc, seqTy);
+  mlir::Value shift = fir::UndefOp::create(*firBuilder, loc, seqTy);
+  mlir::Value bound = fir::UndefOp::create(*firBuilder, loc, seqTy);
...
[truncated]

Copy link
Contributor

@vzakhari vzakhari left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

@clementval clementval merged commit 951f40a into llvm:main Aug 4, 2025
12 checks passed
@clementval clementval deleted the fur_create_unittests branch August 4, 2025 23:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

flang:fir-hlfir flang Flang issues not falling into any other category

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants